							********************************************************************************
							********************************************************************************
								
									*           "Positional Deprivation and Support for			 * 
									* 	     Redistribution and Social Insurance in Europe"      *
									*				 COMPARATIVE POLITICAL STUDIES               *
									*															 *									
									* 		   Brian Burgoon, Sharon Baute, Sam van Noort  	     *
									*															 *
									*															 *
									*          Replication codes for Tables and Figures          *
									*															 *

							********************************************************************************
							********************************************************************************
								
	
****
****
*Replication codes for the paper's Tables and Figures are presented in the order that they appear in the main text and appendices.  All tables and figures were created using data and commands on Stata 16.1. Final formatting was completed after Stata-based production, using Stata graphics and Microsoft Excel and Word.
****
****  

* Figure 2:
use "LIS9505cps.dta"
* Fig2a (upper-left panel)
graph bar periph19505mean periph29505mean periph39505mean periph49505mean periph59505mean periph69505mean periph79505mean periph89505mean periph99505mean periph109505mean , blabel(bar, format(%9.1f)) legend(off)  ytitle("Growth in real household" "disposable income, 1995-2005 (%)") title("European Means 1995-2005") subtitle("by decile of the household income distribution") intensity(*.7)
* Fig2b (lower-left panel)
graph bar periph1_1995_2005-periph10_1995_2005 if country == "Germany" , blabel(bar, format(%9.1f)) legend(off)  ytitle("Growth in real household" "disposable income, 1995-2005 (%)") title("Germany 1995-2005") subtitle("by decile of the household income distribution") intensity(*.7)
* Fig2c (lower-right panel)
graph bar periph1_1995_2005-periph10_1995_2005 if country == "United Kingdom" , blabel(bar, format(%9.1f)) legend(off)  ytitle("Growth in real household" "disposable income, 1995-2005 (%)") title("United Kingdom 1995-2005") subtitle("by decile of the household income distribution") intensity(*.7)


*Table 1
use "ESS1-7e01econpol2cps.dta"
ologit incdif pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.countrycode i.essround if cntryagain!=. [pweight=dweight*pweight] , cl(cntrydeyr4)
est store m1  
ologit incdif pppposdepriv10thmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.countrycode i.essround if cntryagain!=. [pweight=dweight*pweight] , cl(cntrydeyr4)
est store m2
ologit incdif pppposdepriv1stmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.countrycode i.essround if cntryagain!=. [pweight=dweight*pweight] , cl(cntrydeyr4)
est store m3
logit incdifB pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.countrycode i.essround  if cntryagain!=. [pweight=dweight*pweight] , cl(cntrydeyr4)
est store m4
logit incdifB pppposdepriv10thmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.countrycode i.essround if cntryagain!=. [pweight=dweight*pweight] , cl(cntrydeyr4)
est store m5
logit incdifB pppposdepriv1stmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.countrycode i.essround if cntryagain!=. [pweight=dweight*pweight] , cl(cntrydeyr4)
est store m6
estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) stats(N, fmt(%9.3f %9.0g)) legend label collabels(none) varlabels(_cons Constant)


* Figure 3:
use "ESS1-7e01econpol2cps.dta"
xi: logit incdifB pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.countrycode i.essround if cntryagain!=. [pweight=dweight*pweight] , cl(cntrydeyr4) 
*Fig3a (upper-left panel)
margins, at(subjincome=(1(1)4)) 
marginsplot
*Fig3b (upper-right panel)
margins, at(pppposdeprivAVmin=(-18.7(1)3.6)) 
marginsplot
*Fig3c (lower-left panel)
margins, at(educ=(1(1)5)) 
marginsplot


*Figure 4:
use "ESS1-7e01econpol2cps.dta"
*Fig4a (left-hand panel)
xi: logit incdifB pppposdepriv10thmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.countrycode i.essround if cntryagain!=. [pweight=dweight*pweight] , cl(cntrydeyr4) 
margins, at(pppposdepriv10thmin=(-5.1(1)16.3))
marginsplot 
*Fig4b (right-hand panel)
xi: logit incdifB pppposdepriv1stmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.countrycode i.essround if cntryagain!=. [pweight=dweight*pweight] , cl(cntrydeyr4) 
margins, at(pppposdepriv1stmin=(-12.3(1)5.2))
marginsplot 


*Table 2:
use "ESS4econpol2cps.dta", 
xi: ologit incdif pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.cntry [pweight=dweight*pweight] , cl(cntrydec2) 
est store tab1
xi: ologit gvslvue2 pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban i.cntry [pweight=dweight*pweight] , cl(cntrydec2) 
est store tab2
xi: ologit gvhlthc2 pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban  i.cntry [pweight=dweight*pweight] , cl(cntrydec2) 
est store tab3
xi: ologit gvcldcr2 pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban  i.cntry [pweight=dweight*pweight] , cl(cntrydec2) 
est store tab4
xi: ologit gvslvol2 pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban  i.cntry [pweight=dweight*pweight] , cl(cntrydec2) 
est store tab5
xi: ologit gvpdlwk2 pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban  i.cntry [pweight=dweight*pweight] , cl(cntrydec2) 
est store tab6
estout tab1 tab2 tab3 tab4 tab5 tab6, cells(b(star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) stats(N, fmt(%9.3f %9.0g)) legend label collabels(none) varlabels(_cons Constant)


* Figure 5:
* Fig5a (left-hand panel)
use "eubsclose3cps.dta"
gr bar pppposdeprivAVminbe , over(posdepcat) over(Country, label(angle(45))) ytitle("Objective Positional Deprivation" "(per 1-3 Subjective Positional Deprivation)")
* Fig5b (right-hand panel)
use "BBNcollapseliseurscps.dta",
sc posdepcatmeanciph pppposdeprivAVminbe  if iph!=., ml(cntryincstr) xtitle("Objective Positional Deprivation" "(5-year average growth in disposable household income" "MINUS own decile's household income growth in same period)") ytitle("Subjective Positional Deprivation" "(believe own household's income growth" "less than average household's growth last 5 yrs.)") || lfitci  posdepcatmeanciph pppposdeprivAVminbe if iph!=., legend(off) fitplot(line) ciplot(rline)


*Figure 6:
use "eubsclose3cps.dta"
logit posdepB pppposdeprivAVminbe Education_R2 unempB femaleB Age hhsize unempastB attention votedB i.Country if package==2 [pweight=Weight_Country], cl(Serial)
margins, at(pppposdeprivAVminbe=(-2.7(.1)2.82)) saving (mfig6a, replace)
logit posdepB pppposdeprivAVminbe subjincB Education_R2 unempB femaleB Age hhsize unempastB attention votedB i.Country if package==2 [pweight=Weight_Country], cl(Serial)
margins, at(pppposdeprivAVminbe=(-2.7(.1)2.82)) saving (mfig6b, replace)
combomarginsplot mfig6a mfig6b, xtitle("Objective Positional Deprivation" "(5-yr. average growth in disposable household income" "MINUS own decile's household income growth in same period)") ytitle("Subjective Positional Deprivation" "(prob. believing own household's income growth" "less than average household growth in last 5 years)") recast(line)  recastci(rline) labels("Baseline controls" "also subjective income control")


*Table 3:
use "eubsclose3cps.dta"
ologit govredistcat posdepcat Education_R2 subjincome inc_eq unempB femaleB Age hhsize attention unempastB i.Country if package==2 [pweight=Weight_Country], cl(Country)
est store t3a
ologit Q0 posdepcat Education_R2 subjincome inc_eq unempB femaleB Age hhsize attention unempastB i.Country if package==2 [pweight=Weight_Country], cl(Country)
est store t3b
logit govredistB posdepcat Education_R2 subjincome inc_eq unempB femaleB Age hhsize attention unempastB i.Country if package==2 [pweight=Weight_Country], cl(Country)
est store t3c
logit govhelpunemB posdepcat Education_R2 subjincome inc_eq unempB femaleB Age hhsize attention unempastB i.Country if package==2 [pweight=Weight_Country], cl(Country)
est store t3d
biprobit govredistB govhelpunemB posdepcat Education_R2 subjincome inc_eq unempB femaleB Age hhsize attention unempastB i.Country if package==2 [pweight=Weight_Country], cl(Country)
est store t3e
estout t3a t3b t3c t3d t3e , cells(b(star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) stats(N, fmt(%9.3f %9.0g)) legend label collabels(none) varlabels(_cons Constant)


*Figure 7:
use "eubsclose3cps.dta"
logit govredistB posdepcat Education_R2 subjincome inc_eq unempB femaleB Age hhsize attention votedB unempastB i.Country if package==2 [pweight=Weight_Country], cl(Country)
margins, at(posdepcat=(1(1)5)) 
marginsplot, ytitle("Probability of agreeing that government should" "reduce differences in income") xtitle(Subjective Positional Deprivation)
tab subjincome
margins, at(subjincome=(1(1)5)) 
marginsplot, ytitle("Probability of agreeing that government should" "reduce differences in income") xtitle(Subjective Income)
graph use "/Users/Burgoon/Downloads/apsa2019last1.gph"


* Appendix Table A1:
use "ESS1-7e01econpol2cps.dta"
sum incdif incdifB pppposdeprivAVmin pppposdepriv1stmin pppposdepriv10thmin c.subjincome educ unemp age2 gender famforborn relig1 urban if pppposdeprivAVmin!=.&incdif!=.
use "ESS4econpol2cps.dta", 
sum dfincac2 equalgood gvslvue2 gvhlthc2 gvcldcr2 gvslvol2 gvpdlwk2 gvslvueB gvhlthcB gvcldcrB gvslvolB gvpdlwkB if pppposdeprivAVmin!=.


* Appendix Table A2:
use "eubsclose3cps.dta"
sum govredistcat Q0 govredistB govhelpunemB posdepcat Education_R2 subjincome inc_eq unempB femaleB Age hhsize attention votedB unempastB if package==2


*Appendix Table A3 (how objective positional deprivation relates to subjective positional deprivation:
use "eubsclose3cps.dta"
ologit posdepcat pppposdeprivAVminbe i.Country if package==2 [pweight=Weight_Country], cl(Serial)
est store a3a
ologit posdepcat pppposdeprivAVminbe Education_R2 unempB femaleB Age hhsize unempastB attention votedB i.Country if package==2 [pweight=Weight_Country], cl(Serial)
est store a3b
ologit posdepcat pppposdeprivAVminbe Education_R2 subjincB unempB femaleB Age hhsize unempastB attention votedB i.Country if package==2 [pweight=Weight_Country], cl(Serial)
est store a3c
logit posdepB pppposdeprivAVminbe i.Country if package==2 [pweight=Weight_Country], cl(Serial)
est store a3d
logit posdepB pppposdeprivAVminbe Education_R2 unempB femaleB Age hhsize unempastB attention votedB i.Country if package==2 [pweight=Weight_Country], cl(Serial)
est store a3e
logit posdepB pppposdeprivAVminbe Education_R2 subjincB unempB femaleB Age hhsize unempastB attention votedB i.Country if package==2 [pweight=Weight_Country], cl(Serial)
est store a3f
estout a3a a3b a3c a3d a3e a3f, cells(b(star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) stats(N, fmt(%9.3f %9.0g)) legend label collabels(none) varlabels(_cons Constant)


*Appendix Figure A1 
use "ESS4econpol2cps.dta", 
*FigA1a:
rxi: logit equalgoodB pppposdeprivAVmin c.subjincome educ unemp age2 gender famforborn relig1 urban rightB i.cntry [pweight=dweight*pweight] , cl(cntrydec2)
margins, at(pppposdeprivAVmin=(-4.2(1)3.008))
*FigA1b:
margins, at(subjincome=(1(1)4))
marginsplot
*FigA1c:
margins, at(educ=(1(1)5)) 
marginsplot
*FigA1d:
xi: logit equalgoodB pppposdeprivAVmin c.income educ unemp age2 gender famforborn relig1 urban rightB i.cntry [pweight=dweight*pweight] , cl(cntrydec2)
margins, at(income=(1(1)10)) 
marginsplot



